<template>
	<view>
		<u-cell-group>
			<u-cell title="昵称" :value="userInfo.nickname"></u-cell>
			<u-cell title="账号" :value="userInfo.username"></u-cell>
			<u-cell title="修改资料" isLink url="/pages/user/edit"></u-cell>
			<u-cell title="修改密码" isLink url="/pages/user/editPassword"></u-cell>
			<!-- #ifdef APP-PLUS -->
			<u-cell title="退出应用" isLink @click="exit()"></u-cell>
			<!-- #endif -->
			<!-- #ifdef MP-WEIXIN -->
			<u-cell title="订阅通知" isLink @click="subscribe()"></u-cell>
			<!-- <u-cell title="打卡通知" isLink @click="subscribe(1)"></u-cell>
			<u-cell title="工作安排通知" isLink @click="subscribe(2)"></u-cell>
			<u-cell title="异常预警通知" isLink @click="subscribe(3)"></u-cell> -->
			<!-- #endif -->
		</u-cell-group>

		<view class="" style="position: fixed;left: 0;bottom: 20rpx;width: 100%;">
			<view class="" style="margin: 0 20rpx;">
				<u-button type="primary" @click="logout" text="退出登录"></u-button>
			</view>

		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			subscribe(){
				uni.requestSubscribeMessage({
					//打卡提醒模板ID
					tmplIds: ['WLPWAGT-_sKCrIo9Pl1y0DNSlVEF9KWj_AEWIrAajzk','JohhvQvpokgamXVXYgofXUYs4ts9Z6L029CKswTQrDA','wagDtFZX0CuD9oqWuqzv1Y4RxfXbsomx-04-zZ-ohaU'],
					success (res) {
						console.log(res)
					}
				})
				// if(type == 1){
				// 	uni.requestSubscribeMessage({
				// 		//打卡提醒模板ID
				// 		tmplIds: ['WLPWAGT-_sKCrIo9Pl1y0DNSlVEF9KWj_AEWIrAajzk'],
				// 		success (res) {
				// 			console.log(res)
				// 		}
				// 	})
				// }else if(type == 2){
				// 	uni.requestSubscribeMessage({
				// 		//工作安排通知模板ID
				// 		tmplIds: ['JohhvQvpokgamXVXYgofXUYs4ts9Z6L029CKswTQrDA'],
				// 		success (res) {
				// 			console.log(res)
				// 		}
				// 	})
				// }else{
				// 	uni.requestSubscribeMessage({
				// 		//异常预警通知的模板ID
				// 		tmplIds: ['wagDtFZX0CuD9oqWuqzv1Y4RxfXbsomx-04-zZ-ohaU'],
				// 		success (res) {
				// 			console.log(res)
				// 		}
				// 	})
				// }
				
				
				
			},
			logout() {
				this.$api.user.logout({}).then(res => {
					if (res.code == 1) {
						this.$u.toast(res.msg);
					}
					uni.removeStorageSync('lifeData');
					// uni.redirectTo({
					// 	url: '/pages/login/login'
					// })
					uni.reLaunch({ url: '/pages/login/login' })

				})
			},
			exit(){
				// #ifdef APP-PLUS
				plus.runtime.quit();
				return true //return true的意思是禁止返回到上一个界面
				// #endif
			}
		}
	}
</script>

<style>

</style>
